Skip to content

Conversation

@arrayka
Copy link

@arrayka arrayka commented Jan 23, 2026

What

  • Use a seeded pseudo-random generator in the test

Why

  • To fix flaky test_compute_relative_contrast_with_random_data() test

Example of the failure: https://github.com/microsoft/DiskANN/actions/runs/21272293270/job/61224767878?pr=697

    test utils::relative_contrast::relative_contrast_tests::test_compute_relative_contrast_with_random_data ... FAILED

    failures:

    failures:
        utils::relative_contrast::relative_contrast_tests::test_compute_relative_contrast_with_random_data

    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 14 filtered out; finished in 0.50s
    
  stderr ───

    thread 'utils::relative_contrast::relative_contrast_tests::test_compute_relative_contrast_with_random_data' panicked at diskann-tools/src/utils/relative_contrast.rs:192:9:
    Mean relative contrast is out of range: 1.2039199

@arrayka arrayka requested a review from hildebrandmw January 23, 2026 07:04
@arrayka
Copy link
Author

arrayka commented Jan 23, 2026

@microsoft-github-policy-service agree company="Microsoft"

@hildebrandmw
Copy link
Contributor

Thanks Alex - we should be sure to port this (and the other changes made to this repo) internally to reduce the merge headache when we finalize the transition.

Some(seed) => StdRng::seed_from_u64(seed),
None => {
let mut system_rng = rand::rng();
let mut system_rng = random::create_rnd();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be possible to return random::create_rnd() directly since it is already a StdRng. But this pattern is fine since it somewhat decouples the returned RNG from that in diskann_providers::utils::random.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants